package com.lily.smsbox;

import java.util.ArrayList;
import java.util.List;

import android.app.ListActivity;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.widget.ArrayAdapter;

import com.android.provider.Telephony.MmsSms;
import com.android.provider.Telephony.Sms.Conversations;
import com.android.provider.Telephony.Threads;

public class SmsBox extends ListActivity {
 
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    retrieveMessages();
  }

  public void retrieveMessages() {
    Cursor c = getContentResolver().query(Uri.withAppendedPath(MmsSms.CONTENT_URI, "complete-conversations")  , null, null, null, null);
    List<String> arrSnippets = new ArrayList<String>();
////    c.moveToFirst();
//    
    for (int i = 0; i < c.getColumnCount(); i++) {
      arrSnippets.add(c.getColumnName(i));
    }
//    while (c.moveToNext()) {
//      arrSnippets.add(String.valueOf(c.getString(c.getColumnIndex(Contacts.DISPLAY_NAME)) + " " + c.getLong(c.getColumnIndex(Contacts._ID))));
//	
//    }
//    
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, arrSnippets);
    setListAdapter(adapter);
  }
}